<template>
  <div v-loading="initLoading" style="height: 100%;width: 100%;padding: 0;margin: 0;position: relative">
    <template v-if="!initLoading">
      <template v-if="element.props.callCmd">
        <process-assign v-if="element.props.callCmd === 'ProcessAssign'" :element="element" :model-data="modelData" />
        <lims-record-bind v-else-if="element.props.callCmd === 'LimsRecordBind'" :element="element" :model-data="modelData" />
        <lims-record-tab v-else-if="element.props.callCmd === 'LimsRecordTab'" :element="element" :model-data="modelData" />
        <lab-view v-else :element="element" :model-data="modelData" show-view />
      </template>
    </template>
    <div v-if="labProcess.info.processDefId && labProcess.info.mainValue" style="position: absolute;right: 10px;bottom: 50px; z-index: 100">
      <el-button size="medium" type="primary" icon="el-icon-chat-line-square" circle @click="drawer = true"></el-button>
    </div>
    <el-dialog :visible.sync="backVisible" width="450px" title="目标节点选择" :show-close="false" :close-on-click-modal="false" :close-on-press-escape="false">
      <el-form label-position="right" label-width="80px">
        <el-form-item label="目标节点">
          <el-select v-model="labProcess.info.goActivity" style="width: 300px;margin-right: 2px;" placeholder="选择退回节点">
            <el-option v-for="item in labProcess.info.backs" :key="item.id" :value="item.id" :label="item.name" />
          </el-select>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button type="danger" icon="el-icon-check" :loading="labProcess.info.executeIng" @click="processBack(args)">退回</el-button>
        <el-button @click="backVisible = false" :loading="labProcess.info.executeIng" icon="el-icon-close" type="info">取消</el-button>
      </span>
    </el-dialog>
    <el-drawer
        :withHeader="false"
        :modal="false"
        size="60%"
        :close-on-press-escape="true"
        :visible.sync="drawer"
        direction="rtl">
      <process-data />
    </el-drawer>
  </div>
</template>

<script>
import LabView from "../lab-view/LabView";
import LabProcess from "../../mixins/LabProcess";
import UserBranch from "@/views/system/user/UserBranch";
import JobTable from "@/views/system/job/JobTable";
import RoleTable from "@/views/system/role/RoleTable";
import BranchTable from "@/views/system/group/BranchTable";
import ProcessData from "@/views/system/process/ProcessData";
import ProcessAssign from "@/views/system/process/assign/ProcessAssign";
import LimsRecordBind from "@/views/system/process/lims/record/LimsRecordBind";
import LimsRecordTab from "@/views/system/process/lims/record/LimsRecordTab";
export default {
  name: "LabProcess",
  components: {
    LimsRecordTab,
    LimsRecordBind,ProcessAssign, ProcessData, BranchTable, RoleTable, JobTable, UserBranch, LabView},
  mixins: [LabProcess],
  created() {
    this.loadNode()
  },
  data() {
    return {
      drawer: false,
      textarea: ''
    }
  },
  methods: {

  }
}
</script>

<style scoped>

</style>
